
<div class="layui-container fly-marginTop fly-user-main">

    {include file='common/Usermenu'/}

    <!-- 移动端按钮 -->
    <div class="site-tree-mobile layui-hide">
      <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>
    
    <div class="site-tree-mobile layui-hide">
      <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>
    
    
    <div class="fly-panel fly-panel-user" pad20>
      <!--
      <div class="fly-msg" style="margin-top: 15px;">
        您的邮箱尚未验证，这比较影响您的帐号安全，<a href="activate.html">立即去激活？</a>
      </div>
      -->
      <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title" id="LAY_mine">
          <li data-type="mine-jie" lay-id="index" class="layui-this">我的评论（<span>{$commsun}</span>）</li>
        </ul>
        <div class="layui-tab-content" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <ul class="mine-view jie-row">
              {foreach($commits as $item)}
              <li>
                  <a class="jie-title" href="{:url('home/index/info', ['postid' => $item['postid']])}" target="_blank">{$item.content}</a>
                  <i>于{:Tiemstr($item.createtime)}发评论</i>
                  <span class="layui-btn layui-btn-xs jie-admin layui-bg-red delcomment" type="edit" data-del="{$item['id']}">
                    <a href="javascript:void(0)" style="color: white;padding-right: 0;">删除</a>
                  </span>
                  <!-- <a class="mine-edit" href="{:url('home/post/edit', ['postid' => $item['postid']])}">编辑</a> -->
                  {if condition="$item.accept eq 1"}
                  <a class="mine-edit" href="javascript:void(0)">已采纳</a>
                  {/if}
                  <em>{:commsun($item.like)}赞/{$item.comment}答</em>
                </li>
              {/foreach}
            </ul>
            <div id="LAY_page">{$pagestr}</div>
          </div>
    
        </div>
      </div>
    </div>
  </div>
  
  <script>

layui.use('layer', function () {
    var layer = layui.layer
    var $ = layui.jquery

    //删除评论回复
    $('.delcomment').on('click',function(){

      var pid = $(this).attr('data-del');

      console.log(pid);

      layer.confirm('是否确认删除', {
        icon: 3,
        title: '提示'
      }, function (index) {

        //关闭弹框
        layer.close(index)

        //发送异步请求
        $.ajax({
          url: `{:url('home/comment/del')}`,
          type: 'post',
          data: `pid=`+pid,
          dataType: 'json',
          success:function(success)
            { 
              
              if(success.result)
              {
                //成功
                layer.msg(success.msg, {
                  icon: 1,
                  time: 2000 //2秒关闭（如果不配置，默认是3秒）
                }, function(){
                  //直接刷新界面
                  location.reload()
                })
              }else
              {
                //删除失败
                layer.msg(success.msg)
              }
            }
        })
      })
    })


})
  </script>